--毒性射击
local duxingsheji = fk.CreateSkill {
    name = "mcdh_duxingsheji",
    tags = {Skill.Compulsory}
}

local U = require "packages/utility/utility"
local lib = require "packages/mcdh/lib"

duxingsheji:addEffect(fk.TargetSpecified,{
    can_trigger = function(self, event, target, player, data)
        return player:hasSkill(self) and data.card.trueName == "slash" and data.firstTarget and target == player
    end,
    on_use = function(self, event, target, player, data)
        local room = player.room
        local  targets = data:getAllTargets()
        for _, p in ipairs(targets) do
            room:damage({
                from = player,
                to = p,
                damage = 1,
                skillName = self.name,
            })
        end
        data.extra_data = data.extra_data or {}
        data.extra_data.mcdh_duxingsheji = data.extra_data.mcdh_duxingsheji or {}
        table.insertIfNeed(data.extra_data.mcdh_duxingsheji,player.id)
    end
})

duxingsheji:addEffect(fk.CardUseFinished,{
    can_trigger = function(self, event, target, player, data)
        return  data.extra_data and data.extra_data.mcdh_duxingsheji and table.contains(data.extra_data.mcdh_duxingsheji,player.id)
    end,
    on_cost = Util.TrueFunc,
    on_use = function(self, event, target, player, data)
        local room = player.room
        local targets =data:getAllTargets()
        targets =table.filter(targets,function(p) return not (data.damageDealt and data.damageDealt[p])  end)
        for _, p in ipairs(targets) do
            room:recover{
                who = p ,
                num = 1,
                recoverBy = player,
                skillName = self.name
            }
        end
    end,
})

Fk:loadTranslationTable {
    ["mcdh_duxingsheji"] = "毒性射击",
    [":mcdh_duxingsheji"] = "锁定技,当你使用【杀】指定目标后,你对所有目标角色造成一点伤害,此牌结算后，你令所有未受到此牌伤害的目标角色回复一点体力。",
}

return duxingsheji